gridpack::utility::Configuration Class Reference
#include <configuration.hpp>
List of all members.
Classes |
struct | ChildElement |
Public Types |
typedef std::string | KeyType |
typedef Configuration | Cursor |
typedef boost::shared_ptr< Cursor > | CursorPtr |
typedef std::vector< CursorPtr > | ChildCursors |
typedef std::vector< ChildElement > | ChildElements |
Public Member Functions |
| Configuration (void) |
| ~Configuration (void) |
void | enableLogging (std::ostream *=NULL) |
bool | open (const std::string &file, gridpack::parallel::Communicator comm) |
bool | initialize (gridpack::parallel::Communicator comm) |
bool | get (KeyType, bool default_value) |
bool | get (KeyType, bool *) |
int | get (KeyType, int default_value) |
bool | get (KeyType, int *) |
double | get (KeyType, double default_value) |
bool | get (KeyType, double *) |
std::string | get (KeyType, const std::string &default_value) |
std::string | get (KeyType key, const char *default_value) |
bool | get (KeyType, std::string *) |
std::vector< double > | get (KeyType, const std::vector< double > &default_value) |
bool | get (KeyType, std::vector< double > *) |
CursorPtr | getCursor (KeyType) |
const std::string & | path () |
void | children (ChildCursors &) |
void | children (ChildElements &) |
Static Public Member Functions |
static Configuration * | configuration () |
Static Public Attributes |
static const char | KeySep = '.' |
Member Typedef Documentation
This class represents a prefix of a set of key names. Conveniently this implementation allows it to be the same class
Constructor & Destructor Documentation
gridpack::utility::Configuration::Configuration |
( |
void |
|
) |
|
gridpack::utility::Configuration::~Configuration |
( |
void |
|
) |
|
Member Function Documentation
void gridpack::utility::Configuration::children |
( |
ChildElements & |
|
) |
|
void gridpack::utility::Configuration::children |
( |
ChildCursors & |
|
) |
|
static Configuration* gridpack::utility::Configuration::configuration |
( |
|
) |
[static] |
Access a common instance, shared by all modules in configuration database,
void gridpack::utility::Configuration::enableLogging |
( |
std::ostream * |
= NULL |
) |
|
enable logging for diagnostics and provenence (default is std::cout)
bool gridpack::utility::Configuration::get |
( |
KeyType |
, |
|
|
std::vector< double > * |
| |
|
) |
| | |
std::vector<double> gridpack::utility::Configuration::get |
( |
KeyType |
, |
|
|
const std::vector< double > & |
default_value | |
|
) |
| | |
bool gridpack::utility::Configuration::get |
( |
KeyType |
, |
|
|
std::string * |
| |
|
) |
| | |
std::string gridpack::utility::Configuration::get |
( |
KeyType |
key, |
|
|
const char * |
default_value | |
|
) |
| | |
std::string gridpack::utility::Configuration::get |
( |
KeyType |
, |
|
|
const std::string & |
default_value | |
|
) |
| | |
bool gridpack::utility::Configuration::get |
( |
KeyType |
, |
|
|
double * |
| |
|
) |
| | |
double gridpack::utility::Configuration::get |
( |
KeyType |
, |
|
|
double |
default_value | |
|
) |
| | |
bool gridpack::utility::Configuration::get |
( |
KeyType |
, |
|
|
int * |
| |
|
) |
| | |
int gridpack::utility::Configuration::get |
( |
KeyType |
, |
|
|
int |
default_value | |
|
) |
| | |
bool gridpack::utility::Configuration::get |
( |
KeyType |
, |
|
|
bool * |
| |
|
) |
| | |
bool gridpack::utility::Configuration::get |
( |
KeyType |
, |
|
|
bool |
default_value | |
|
) |
| | |
For each supported type, there are two variants. One takes a default value that is returned if the key is not present in the configuration file, the other takes a pointer to an output location and returns a boolean. When the boolean is true the output location is updated with the value
- Parameters:
-
| KeyType | data key in key-value pair |
| default_value | data value in key-value pair |
select a prefix, returns NULL of the prefix has no defined keys. The XML-based implementation on top of boost property maps might have multiple elements with the same name. This will simply return a pointer to the first, which might not be sufficient. This function will set the cursor so that it matches the XML block pointed to by the KeyType variable. For example, if the key type is set to "Configuration.Powerflow", then subsequent calls to get will look for variables within the block deliminated by <Configuration><Powerflow>...</Powerflow></Configuration>
- Parameters:
-
| KeyType | string representing data block to set cursor return cursor pointing to correct data block in configuration file |
Deprecated method that initializes configuration on all processes except process 0. Can be used in conjunction with "open" call on process 0.
- Parameters:
-
| Communicator | being used in calculation |
- Returns:
- false if there is an error reading XML file
read a configuration file. true == success, false == some kind of failure Open external configuration file on all ranks on communicator comm
- Parameters:
-
| file | name of external configuration file |
| Communicator | being used in calculation |
- Returns:
- false if there is an error reading XML file
const std::string& gridpack::utility::Configuration::path |
( |
|
) |
|
Member Data Documentation
The documentation for this class was generated from the following file: